# Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
# This source file is part of the Cangjie project, licensed under Apache-2.0
# with Runtime Library Exception.
#
# See https://cangjie-lang.cn/pages/LICENSE for license information.

cmake_minimum_required(VERSION 3.16.5)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
project(cjmigrator)

# Link stdc++fs globally for old GCC (7/8)
add_library(fs_compat INTERFACE)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
    target_link_libraries(fs_compat INTERFACE stdc++fs)
endif()

# set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# set(SANITIZER_FLAGS "-g -O0 -fsanitize=address -fno-omit-frame-pointer")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SANITIZER_FLAGS}")
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SANITIZER_FLAGS}")

set(CMAKE_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/cmake)

include_directories(common)

add_subdirectory(platform)

add_subdirectory(versions)

add_subdirectory(src)
